package com.neusoft.gene.nep.grid.cfg;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description: TODO  MybatisPlusConfig MybatisPlusConfig
 * MyBatis-Plus 的配置类
 * @author: 君醉
 * @date: 2024/6/19 15:01
*/

@Configuration
public class MybatisPlusConfig {

    // 创建 MybatisPlusInterceptor 对象
    //MybatisPlusInterceptor 是 MyBatis-Plus 提供的拦截器
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        // 创建 MybatisPlusInterceptor 对象
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();

        // 添加分页拦截器
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
}